﻿using System;
using TheClerk.Access;
using Org.BouncyCastle.Asn1;

namespace TheClerk.Forms
{
    /// <summary>
    /// A field is a singular index/value pair: the index is a string (unique
    /// in the scope of the Form) and the value is a Collection.
    /// </summary>
    /// <remarks>
    /// Key/value pair, with the key being something which can be
    /// converted to a string.
    /// 
    /// The blob contains a list containing the actual data associated with
    /// the index as well as other attributes (such as acls).
    /// </remarks>
    public class Field : Org.BouncyCastle.Asn1.Asn1Encodable
    {
        #region Private Members
        private AccessControlList _acl;
        private ContentType _type;
        private Identity _sendingidentity;
        private byte[] _content;
        private string mimeType;
        private System.IO.Stream inputStream;
        #endregion

#region Constructors
        public Field(string mimeType, System.IO.Stream inputStream)
        {
            // TODO: Complete member initialization
            this.mimeType = mimeType;
            this.inputStream = inputStream;
        }
        #endregion

        #region Accessors

        internal AccessControlList Acl
        {
            get { return _acl; }
            set { _acl = value; }
        }
        

        internal ContentType ContentType
        {
            get { return _type; }
            set { _type = value; }
        }
        
        public Identity SendingIdentity
        {
            get { return _sendingidentity; }
            set { _sendingidentity = value; }
        }


        public byte[] Content
        {
            get { return _content; }
            set { _content = value; }
        }
        #endregion

        #region Org.BouncyCastle.Asn1.Asn1Encodable abstract members

        public override Asn1Object ToAsn1Object()
        {
            throw new NotImplementedException();
        }

        #endregion

    }
}
